import 'package:canvas/canvas/draw_love.dart';
import 'package:canvas/canvas/stop_anime.dart';
import 'package:flutter/material.dart';
import 'canvas/canvas_paint.dart';
import 'canvas/custom_painter.dart';
import 'canvas/gesture.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'MaterialApp',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: '自学demo'),
      // home: const CanvasPaint(),
      // home: const GestureTest(),
      // home: ListenerSample(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Center(child: Text(widget.title)),
      ),
      body: ListView(

        children: [
          ElevatedButton(onPressed: (){
            Navigator.push(context, MaterialPageRoute(builder: (context)=>const CanvasPaint()));
          }, child: const Text("自制画板")),
          ElevatedButton(onPressed: (){
            Navigator.push(context, MaterialPageRoute(builder: (context)=>const GestureTest()));
          }, child: const Text("手势学习")),
          ElevatedButton(onPressed: (){
            Navigator.push(context, MaterialPageRoute(builder: (context)=>const StopAnime()));
          }, child: const Text("禁止动画")),
          ElevatedButton(onPressed: (){
            Navigator.push(context, MaterialPageRoute(builder: (context)=> const DrawLoveWidget()));
          }, child: const Text("画爱心")),
        ],

      )

    );
  }
}
